/** *------------------------------------------------------------------------------ * @package T3 Framework for Joomla! *------------------------------------------------------------------------------ * @copyright Copyright (C) 2004-2013 JoomlArt.com. All Rights Reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @authors JoomlArt, JoomlaBamboo, (contribute to this project at github * & Google group to become co-author) * @Google group: https://groups.google.com/forum/#!forum/t3fw * @Link: http://t3-framework.org *------------------------------------------------------------------------------ */ jQuery (document).ready(function($){ function getAndroidVersion(ua) { var ua = ua || navigator.userAgent; var match = ua.match(/Android\s([0-9\.]*)/); return match ? match[1] : false; }; if (parseInt(getAndroidVersion()) == 4) { $('#t3-mainnav').addClass('t3-mainnav-android'); } var JA_isLoading = false; // fix for old ie if (/MSIE\s([\d.]+)/.test(navigator.userAgent) ? new Number(RegExp.$1) < 10 : false) { $('html').addClass ('old-ie'); } else if(/constructor/i.test(window.HTMLElement)){ $('html').addClass('safari'); } var $wrapper = $('body'), $inner = $('.t3-wrapper'), $toggles = $('.off-canvas-toggle'), $offcanvas = $('.t3-off-canvas'), $close = $('.t3-off-canvas .close'), $btn=null, $nav=null, direction = 'left', $fixed = null; // no wrapper, just exit if (!$wrapper.length) return ; // add effect class for nav $toggles.each (function () { var $this = $(this), $nav = $($this.data('nav')), effect = $this.data('effect'), direction = ($('html').attr('dir') == 'rtl' && $this.data('pos')!='right') || ($('html').attr('dir') != 'rtl' && $this.data('pos')=='right') ? 'right':'left'; $nav.addClass (effect).addClass ('off-canvas-'+direction); // move to outside wrapper-content var inside_effect = ['off-canvas-effect-3','off-canvas-effect-16','off-canvas-effect-7','off-canvas-effect-8','off-canvas-effect-14']; if ($.inArray(effect, inside_effect) == -1) { $inner.before($nav); } else { $inner.prepend($nav); } }); $toggles.on('tap', function(e){ // detect direction stopBubble (e); if ($wrapper.hasClass ('off-canvas-open')) { oc_hide (e); return false; } $btn = $(this); $nav = $($btn.data('nav')); if (!$fixed) $fixed = $inner.find('*').filter (function() {return $(this).css("position") === 'fixed';}); else $fixed = $fixed.filter (function() {return $(this).css("position") === 'fixed';}).add($inner.find('.affix')); $nav.addClass ('off-canvas-current'); direction = ($('html').attr('dir') == 'rtl' && $btn.data('pos')!='right') || ($('html').attr('dir') != 'rtl' && $btn.data('pos')=='right') ? 'right':'left'; // add direction class to body // $('html').removeClass ('off-canvas-left off-canvas-right').addClass ('off-canvas-' + direction); $offcanvas.height($(window).height()); // disable scroll event var events = $(window).data('events'); if (events && events.scroll && events.scroll.length) { // store current handler for scroll var handlers = []; for (var i=0; i 1 && arr1[1].length) { oc_hide(); setTimeout(function(){ var anchor = $("a[name='"+ arr1[1] +"']"); if (!anchor.length) anchor = $('#' + arr1[1]); $('html,body').animate({scrollTop: anchor.offset().top},'slow'); }, 500); } } stopBubble(e); return true; } var stopBubble = function (e) { e.stopPropagation(); } // preload fixed items $(window).load(function() { setTimeout(function(){ $fixed = $inner.find('*').filter (function() {return $(this).css("position") === 'fixed';}); }, 100); }); })